home *** CD-ROM | disk | FTP | other *** search
/ Totally for Newton 10 / PDA10.toast / mac / Packages / Programming / 2.x / More Routing / MiscFunctions.f < prev    next >
Encoding:
Text File  |  1997-03-14  |  1.1 KB  |  54 lines  |  [TEXT/R*ch]

  1. // Copyright (c) 1996-1997 Jeremy Wyld. All rights reserved.
  2. /* For best viewing pleasure set the font to: Courier 10pt with 3 space tabs */
  3.  
  4.  
  5. vars.KnownGlobalFunctions.DeclareGlobalFn := 2;
  6.  
  7. DefConst('kOpenThingFunc, func(what) begin
  8.  
  9.     local r := GetRoot();                                        // Grab root for reference.
  10.     
  11.     if NOT Visible(r.(what)) then
  12.         r.(what):Open();                                            // Open if not open.
  13.         
  14.     else
  15.         r.(what):MoveBehind(NIL);                                // Bring to foreground if open.
  16.         
  17.     NIL;
  18. end);        // end kOpenThingFunc()
  19.  
  20.  
  21. _AllRouteFrames := [];
  22.  
  23. DefGlobalFn('AddRouteFrame, func(routeFrame) begin
  24.  
  25.     AddArraySlot(_AllRouteFrames, routeFrame);
  26.     
  27. end);
  28. DeclareGlobalFn('AddRouteFrame, 1);
  29.  
  30. DefGlobalFn('AddRouteItem, func(title, icon, method) begin
  31.  
  32.     AddRouteFrame({
  33.         title:    title,
  34.         icon:        icon,
  35.         routeScript:    method});
  36.  
  37. end);
  38. DeclareGlobalFn('AddRouteItem, 3);
  39.  
  40. DefGlobalFn('AddOpenItem, func(title, icon, symbol) begin
  41.  
  42.     AddRouteItem(title, icon, func(x,y) call kOpenThingFunc with (symbol));
  43.     
  44. end);
  45. DeclareGlobalFn('AddOpenItem, 3);
  46.  
  47. DefGlobalFn('AddSeparator, func() begin
  48.  
  49.     AddArraySlot(_AllRouteFrames, 'pickseparator);
  50.     
  51. end);
  52. DeclareGlobalFn('AddSeparator, 0);
  53.  
  54.